package com.teamwork.module01.controller;


import com.teamwork.common.entity.module01.Subject;
import com.teamwork.common.entity.module01.Teacher;
import com.teamwork.common.result.Result;
import com.teamwork.module01.service.TeacherService;
import org.springframework.web.bind.annotation.*;

import javax.annotation.Resource;
import java.util.List;

@RestController("/api/mod01/teacher")
public class TeacherController {

    @Resource
    private TeacherService teacherService;


    @GetMapping("/getbyname")
    public Result getByname(String name){
        return teacherService.getByName(name);
    }
    @GetMapping("/page")
    public Result page(Integer page,Integer size){
        return teacherService.getPage(page,size);
    }
    @PostMapping
    public Result InsertOrUpdate(@RequestBody Teacher teacher){
        return teacherService.InsertOrUpdate(teacher);
    }
    @DeleteMapping("/{id}")
    public Result delete(@PathVariable Integer id){
        return teacherService.deleteById(id);
    }
    @DeleteMapping
    public Result batchDelete(List<Integer> ids){
        return teacherService.batchDelete(ids);
    }


}
